package com.xiaoshuidi.cloud.module.finance.mq.producer;

import com.xiaoshuidi.cloud.framework.common.util.json.JsonUtils;
import com.xiaoshuidi.cloud.framework.mq.core.RocketMQMessageDelayLevel;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.common.message.MessageConst;
import org.springframework.cloud.stream.function.StreamBridge;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Slf4j
@Component
public class CouponUnlockDelayProducer {
    @Resource
    private StreamBridge streamBridge;

    public void send(Long payOrderId) {
        if (log.isDebugEnabled()) {
            log.debug("发送优惠券解锁延时消息 {}", payOrderId);
        }
//        streamBridge.send("couponUnlockDelay-out-0", MessageBuilder
//                .withPayload(JsonUtils.getObjectMapper().createObjectNode().put("id", payOrderId))
//                .setHeader(MessageConst.PROPERTY_DELAY_TIME_LEVEL, RocketMQMessageDelayLevel._2m).build());
    }

}
